package com.cloudbroker.bcs.platform.ltb.middle.service.base;

import com.cloudbroker.bcs.common.entity.Markable;
import com.cloudbroker.bcs.common.entity.Pageable;
import com.cloudbroker.bcs.platform.ltb.middle.context.HSBCPSBizDataContext;

public abstract class TenantServiceImplBase<T extends Pageable, K> extends MycatServiceImplBase<T, K> {
    
    @Override
    public void save(T entity) {
        if (entity instanceof Markable) {
            Markable markable = (Markable) entity;
            if (HSBCPSBizDataContext.getTenantId() != null && markable.getTenant_id() == null) {
                markable.setTenant_id(HSBCPSBizDataContext.getTenantId());
            }
        }
        super.save(entity);
    }
    
}
